<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
	<!DOCTYPE html>
	<html>
<head>
<meta charset="UTF-8">
<title>玩/艺术/学乐/达人-作者表 编辑页面</title>
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<jsp:include page="../com/header.jsp"></jsp:include>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/comm/editcomm.js"></script>
<script type="text/javascript">
	$(function() {
// 		getDataById(root + 'cms/artInformation/findArtInformationById',"#artInformationTmpl","#artInformationContent");
		$("#saveOrupdate").click(function() {
			$("#authorIconPic").val(imgUrl);
			if (!$('#artInformationContent').find('#myImageShow').attr('src')) {
				myAlert("请上传图片");
				return;
			}
			saveData(root + 'cms/artInformation/saveArtInformation','artInformationList.jsp');
		});
		var tId = getUrlParam("id");
		if (!tId) {
			myAlert('id参数不能为空');
			return;
		}
		$.ajax({
			url : root + 'cms/artInformation/findArtInformationById',
			type : 'post',
			dataType : 'json',
			data : {
				modelId : tId
			},
			success : function(data) {
				console.log(data);
				if (data.code == 1) {
					var contentHtml = $('#artInformationTmpl').render(
							data.object, {
								mydata : data
							});
					$('#artInformationContent').html(contentHtml);
					ue = UE.getEditor("authorIntroduce");
					ue.addListener("ready", function() {
						if (data.object.authorIntroduce)
							ue.setContent(data.object.authorIntroduce);
					});
					ue1 = UE.getEditor("authorExhibition");
					ue1.addListener("ready", function() {
						if (data.object.authorExhibition)
							ue1.setContent(data.object.authorExhibition);
					});
					$("#authorAge").datetimepicker({format: 'yyyy-mm',minView: 'month',language : 'zh-CN',autoclose: true}).on('changeDate',function(ev){
		            	var starttime=$("#authorAge").val();
		            	$("#authorAge").datetimepicker('hide');
		            });
				} else {
					var contentHtml = $('#artInformationTmpl').render("");
					$('#artInformationContent').html(contentHtml);
				}
			}
		});
		//上传图片
        $('#artInformationContent').on('click','#uploadPhotoFile', function () {
			upload("artInformation");
        });
	});
</script>
</head>
<body>
	<section>
		<div>
			<div class="col-xs-12">
				<div class="box" style="height:1200px">
					<div class="box-header">
						<br> <input type="button" value="确定" id="saveOrupdate"
							class="btn btn-success">
						<input type="button" onclick="backAction('artInformationList.jsp');" class="btn btn-info" value="返回"/>
					</div>
					<form id="submit_form" class="form-horizontal">
						<div class="tab" id="artInformationContent"></div>
					</form>
				</div>
			</div>
		</div>
	</section>
	<script type="text/x-jsrender" id="artInformationTmpl">
			<fieldset> 
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
	        	{{!--<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:imgUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="imgUrl" name="imgUrl" value="{{:imgUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>--}}
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">作者名称：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写作者名称" class="form-control input-sm" data-rule="required;length[0~50]" id="authorName" name="authorName" value="{{:authorName}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">性别：</label>
       				 <div class="col-md-3">
						<select class="form-control input-sm" id="authorSex" name="authorSex" data-rule="required" >
                          <option  value="">请选择</option>
                          <option  value="1" {{if authorSex=="1"}}selected{{/if}}>男</option>
                          <option  value="2" {{if authorSex=="2"}}selected{{/if}}>女</option>
                        </select>	
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">出生日期：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写出生日期" class="form-control input-sm" data-rule="required;length[0~50]" id="authorAge" name="authorAge" value="{{:authorAge}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">头衔：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写头衔" class="form-control input-sm" data-rule="required;length[0~50]" id="authorTitle" name="authorTitle" value="{{:authorTitle}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">作者爱好：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写作者爱好" class="form-control input-sm" data-rule="required;length[0~50]" id="authorHobby" name="authorHobby" value="{{:authorHobby}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">联系方式：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写作者联系方式" class="form-control input-sm" data-rule="required;length[0~50];mobile || tel" id="authorMobile" name="authorMobile" value="{{:authorMobile}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">排序值：</label>
       				 <div class="col-md-4">
						<input type="text" placeholder="请填写排序值" class="form-control input-sm" data-rule="length[1~10];plus" maxlength="10" id="sort" name="sort" value="{{:sort}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">头像/作品图：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:authorIconPic}}" width="100px" height="100px" />
                        	<input type="hidden" id="authorIconPic" name="authorIconPic" value="{{:authorIconPic}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">个人简介:</label>
					<div class="col-md-9" id="authorIntroduce" name="authorIntroduce" style="height:200px;"></div>
					{{!--<input type="text" placeholder="请填写个人简介（富文本）" class="form-control input-sm" data-rule="required;length[0~50]" id="authorIntroduce" name="authorIntroduce" value="{{:authorIntroduce}}" />--}}
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">主要展览:</label>
					<div class="col-md-9" id="authorExhibition" name="authorExhibition" style="height:200px;"></div>
      			</div>
			</fieldset>
	</script>
</body>
	</html></i>